<?php
namespace BP\Sys;
require_once("BP/En/Map.php");
require_once("BP/Tools/DateUtils.php");
require_once("BP/WF/RefObject.php");
require_once("BP/Web/WebUser.php");
class MapData extends EntityNoName {
	protected $_HisEns;	// Entities
	protected $_HisEn;	// GEEntity
	protected $_HisFEB;	// FormEventBase
	private function __init() { // default class members
		$this->_HisEns = NULL;
		$this->_HisEn = NULL;
		$this->_HisFEB = NULL;
	}
	public function getEnsName () 
	{
		return $this->GetValStringByKey(MapDataAttr::$EnsName);
	}
	public function setEnsName ($value) // [String value]
	{
		$this->SetPara(MapDataAttr::$EnsName, $value);
	}
	public function getIsRowLock () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsRowLock,  FALSE );
	}
	public function setIsRowLock ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsRowLock, $value);
	}
	public function getIsWoEnablePrint () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnablePrint);
	}
	public function setIsWoEnablePrint ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnablePrint, $value);
	}
	public function getIsWoEnableReadonly () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableReadonly);
	}
	public function setIsWoEnableReadonly ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableReadonly, $value);
	}
	public function getIsWoEnableRevise () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableRevise);
	}
	public function setIsWoEnableRevise ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableRevise, $value);
	}
	public function getIsWoEnableSave () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableSave);
	}
	public function setIsWoEnableSave ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableSave, $value);
	}
	public function getIsWoEnableViewKeepMark () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableViewKeepMark);
	}
	public function setIsWoEnableViewKeepMark ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableViewKeepMark, $value);
	}
	public function getIsWoEnableWF () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableWF);
	}
	public function setIsWoEnableWF ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableWF, $value);
	}
	public function getIsWoEnableOver () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableOver);
	}
	public function setIsWoEnableOver ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableOver, $value);
	}
	public function getIsWoEnableSeal () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableSeal);
	}
	public function setIsWoEnableSeal ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableSeal, $value);
	}
	public function getIsWoEnableTemplete () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableTemplete);
	}
	public function setIsWoEnableTemplete ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableTemplete, $value);
	}
	public function getIsWoEnableCheck () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableCheck);
	}
	public function setIsWoEnableCheck ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableCheck, $value);
	}
	public function getIsWoEnableInsertFlow () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableInsertFlow);
	}
	public function setIsWoEnableInsertFlow ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableInsertFlow, $value);
	}
	public function getIsWoEnableInsertFengXian () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableInsertFengXian);
	}
	public function setIsWoEnableInsertFengXian ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableInsertFengXian, $value);
	}
	public function getIsWoEnableMarks () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableMarks);
	}
	public function setIsWoEnableMarks ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableMarks, $value);
	}
	public function getIsWoEnableDown () 
	{
		return $this->GetParaBoolen(FrmAttachmentAttr::$IsWoEnableDown);
	}
	public function setIsWoEnableDown ($value) // [boolean value]
	{
		$this->SetPara(FrmAttachmentAttr::$IsWoEnableDown, $value);
	}
	public function getMaxLeft () 
	{
		return $this->GetParaFloat(MapDataAttr::$MaxLeft);
	}
	public function setMaxLeft ($value) // [float value]
	{
		$this->SetPara(MapDataAttr::$MaxLeft, $value);
	}
	public function getMaxRight () 
	{
		return $this->GetParaFloat(MapDataAttr::$MaxRight);
	}
	public function setMaxRight ($value) // [float value]
	{
		$this->SetPara(MapDataAttr::$MaxRight, $value);
	}
	public function getMaxTop () 
	{
		return $this->GetParaFloat(MapDataAttr::$MaxTop);
	}
	public function setMaxTop ($value) // [float value]
	{
		$this->SetPara(MapDataAttr::$MaxTop, $value);
	}
	public function getMaxEnd () 
	{
		return $this->GetParaFloat(MapDataAttr::$MaxEnd);
	}
	public function setMaxEnd ($value) // [float value]
	{
		$this->SetPara(MapDataAttr::$MaxEnd, $value);
	}
	public function getRptIsSearchKey () 
	{
		return $this->GetParaBoolen(MapDataAttr::$RptIsSearchKey,  TRUE );
	}
	public function setRptIsSearchKey ($value) // [boolean value]
	{
		$this->SetPara(MapDataAttr::$RptIsSearchKey, $value);
	}
	public function getRptDTSearchWay () 
	{
		return DTSearchWay->forValue($this->GetParaInt(MapDataAttr::$RptDTSearchWay));
	}
	public function setRptDTSearchWay ($value) // [DTSearchWay value]
	{
		$this->SetPara(MapDataAttr::$RptDTSearchWay, $value->getValue());
	}
	public function getRptDTSearchKey () 
	{
		return $this->GetParaString(MapDataAttr::$RptDTSearchKey);
	}
	public function setRptDTSearchKey ($value) // [String value]
	{
		$this->SetPara(MapDataAttr::$RptDTSearchKey, $value);
	}
	public function getRptSearchKeys () 
	{
		return $this->GetParaString(MapDataAttr::$RptSearchKeys, "*");
	}
	public function setRptSearchKeys ($value) // [String value]
	{
		$this->SetPara(MapDataAttr::$RptSearchKeys, $value);
	}
	public function getVer () 
	{
		return $this->GetValStringByKey(MapDataAttr::$Ver);
	}
	public function setVer ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$Ver, $value);
	}
	public function getIdx () 
	{
		return $this->GetValIntByKey(MapDataAttr::$Idx);
	}
	public function setIdx ($value) // [int value]
	{
		$this->SetValByKey(MapDataAttr::$Idx, $value);
	}
	public function getHisFrmEles () 
	{
		$tempVar = $this->GetRefObject("FrmEles");
		$obj = ( ($tempVar instanceof FrmEles) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEles::constructor__String($this->getNo());
			$this->SetRefObject("FrmEles", $obj);
		}
		return $obj;
	}
	public function getMapFrames () 
	{
		$tempVar = $this->GetRefObject("MapFrames");
		$obj = ( ($tempVar instanceof MapFrames) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapFrames::constructor__String($this->getNo());
			$this->SetRefObject("MapFrames", $obj);
		}
		return $obj;
	}
	public function getGroupFields () 
	{
		$tempVar = $this->GetRefObject("GroupFields");
		$obj = ( ($tempVar instanceof GroupFields) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = GroupFields::constructor__String($this->getNo());
			$this->SetRefObject("GroupFields", $obj);
		}
		return $obj;
	}
	public function getMapExts () 
	{
		$tempVar = $this->GetRefObject("MapExts");
		$obj = ( ($tempVar instanceof MapExts) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapExts::constructor__String($this->getNo());
			$this->SetRefObject("MapExts", $obj);
		}
		return $obj;
	}
	public function getFrmEvents () 
	{
		$tempVar = $this->GetRefObject("FrmEvents");
		$obj = ( ($tempVar instanceof FrmEvents) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEvents::constructor__I($this->getNo());
			$this->SetRefObject("FrmEvents", $obj);
		}
		return $obj;
	}
	public function getOrigMapDtls () 
	{
		$tempVar = $this->GetRefObject("MapDtls");
		$obj = ( ($tempVar instanceof MapDtls) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapDtls::constructor__();
			$obj->Retrieve(MapDtlAttr::$FK_MapData, $this->getNo(), MapDtlAttr::$FK_Node, 0);
			$this->SetRefObject("MapDtls", $obj);
		}
		return $obj;
	}
	public function getMapDtls () 
	{
		$tempVar = $this->GetRefObject("MapDtls");
		$obj = ( ($tempVar instanceof MapDtls) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapDtls::constructor__String($this->getNo());
			$this->SetRefObject("MapDtls", $obj);
		}
		return $obj;
	}
	public function getSysEnums () 
	{
		$tempVar = $this->GetRefObject("SysEnums");
		$obj = ( ($tempVar instanceof SysEnums) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = SysEnums::constructor__();
			if ((SystemConfig::getAppCenterDBType() == $DBType->MySQL))
			{
				$strs = "";
				$dt = DBAccess->RunSQLReturnTable((("SELECT UIBindKey FROM Sys_MapAttr WHERE FK_MapData='" . $this->getNo()) . "' AND LGType=1  "));
				foreach ($dt->Rows as $dr) 				{
					$strs += (("'" . $dr->getValue(0)) . "',");
				}
				if (($dt->Rows->size() >= 1))
				{
					$strs += "'ssss'";
					$obj->RetrieveInOrderBy("EnumKey", $strs, SysEnumAttr::$IntKey);
				}
			}
			else
			{
				$obj->RetrieveInSQL(SysEnumAttr::$EnumKey, (("SELECT UIBindKey FROM Sys_MapAttr WHERE FK_MapData='" . $this->getNo()) . "' AND LGType=1 "), SysEnumAttr::$IntKey);
			}
			$this->SetRefObject("SysEnums", $obj);
		}
		return $obj;
	}
	public function getFrmRpts () 
	{
		$tempVar = $this->GetRefObject("FrmRpts");
		$obj = ( ($tempVar instanceof FrmRpts) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmRpts::constructor__String($this->getNo());
			$this->SetRefObject("FrmRpts", $obj);
		}
		return $obj;
	}
	public function getFrmLinks () 
	{
		$tempVar = $this->GetRefObject("FrmLinks");
		$obj = ( ($tempVar instanceof FrmLinks) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLinks::constructor__String($this->getNo());
			$this->SetRefObject("FrmLinks", $obj);
		}
		return $obj;
	}
	public function getFrmBtns () 
	{
		$tempVar = $this->GetRefObject("FrmBtns");
		$obj = ( ($tempVar instanceof FrmBtns) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmBtns::constructor__String($this->getNo());
			$this->SetRefObject("FrmBtns", $obj);
		}
		return $obj;
	}
	public function getFrmEles () 
	{
		$tempVar = $this->GetRefObject("FrmEles");
		$obj = ( ($tempVar instanceof FrmEles) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmEles::constructor__String($this->getNo());
			$this->SetRefObject("FrmEles", $obj);
		}
		return $obj;
	}
	public function getFrmLines () 
	{
		$tempVar = $this->GetRefObject("FrmLines");
		$obj = ( ($tempVar instanceof FrmLines) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLines::constructor__String($this->getNo());
			$this->SetRefObject("FrmLines", $obj);
		}
		return $obj;
	}
	public function getFrmLabs () 
	{
		$tempVar = $this->GetRefObject("FrmLabs");
		$obj = ( ($tempVar instanceof FrmLabs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmLabs::constructor__String($this->getNo());
			$this->SetRefObject("FrmLabs", $obj);
		}
		return $obj;
	}
	public function getFrmImgs () 
	{
		$tempVar = $this->GetRefObject("FrmImgs");
		$obj = ( ($tempVar instanceof FrmImgs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgs::constructor__String($this->getNo());
			$this->SetRefObject("FrmImgs", $obj);
		}
		return $obj;
	}
	public function getFrmAttachments () 
	{
		$tempVar = $this->GetRefObject("FrmAttachments");
		$obj = ( ($tempVar instanceof FrmAttachments) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmAttachments::constructor__String($this->getNo());
			$this->SetRefObject("FrmAttachments", $obj);
		}
		return $obj;
	}
	public function getFrmImgAths () 
	{
		$tempVar = $this->GetRefObject("FrmImgAths");
		$obj = ( ($tempVar instanceof FrmImgAths) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgAths::constructor__String($this->getNo());
			$this->SetRefObject("FrmImgAths", $obj);
		}
		return $obj;
	}
	public function getFrmImgAthDB () 
	{
		$tempVar = $this->GetRefObject("FrmImgAthDBs");
		$obj = ( ($tempVar instanceof FrmImgAthDBs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmImgAthDBs::constructor__String($this->getNo());
			$this->SetRefObject("FrmImgAthDBs", $obj);
		}
		return $obj;
	}
	public function getFrmRBs () 
	{
		$tempVar = $this->GetRefObject("FrmRBs");
		$obj = ( ($tempVar instanceof FrmRBs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = FrmRBs::constructor__String($this->getNo());
			$this->SetRefObject("FrmRBs", $obj);
		}
		return $obj;
	}
	public function getMapAttrs () 
	{
		$tempVar = $this->GetRefObject("MapAttrs");
		$obj = ( ($tempVar instanceof MapAttrs) ? $tempVar : NULL );
		if (($obj == NULL))
		{
			$obj = MapAttrs::constructor__String($this->getNo());
			$this->SetRefObject("MapAttrs", $obj);
		}
		return $obj;
	}
	public function CleanObject () 
	{
		$this->getRow()->SetValByKey("FrmEles", NULL);
		$this->getRow()->SetValByKey("MapFrames", NULL);
		$this->getRow()->SetValByKey("GroupFields", NULL);
		$this->getRow()->SetValByKey("MapExts", NULL);
		$this->getRow()->SetValByKey("FrmEvents", NULL);
		$this->getRow()->SetValByKey("MapDtls", NULL);
		$this->getRow()->SetValByKey("SysEnums", NULL);
		$this->getRow()->SetValByKey("FrmRpts", NULL);
		$this->getRow()->SetValByKey("FrmLinks", NULL);
		$this->getRow()->SetValByKey("FrmBtns", NULL);
		$this->getRow()->SetValByKey("FrmEles", NULL);
		$this->getRow()->SetValByKey("FrmLines", NULL);
		$this->getRow()->SetValByKey("FrmLabs", NULL);
		$this->getRow()->SetValByKey("FrmAttachments", NULL);
		$this->getRow()->SetValByKey("FrmImgAthDBs", NULL);
		$this->getRow()->SetValByKey("FrmRBs", NULL);
		$this->getRow()->SetValByKey("MapAttrs", NULL);
		return ;
	}
	public function ClearCash () 
	{
		CashFrmTemplate->Remove($this->getNo());
		$this->CleanObject();
	}
	public function getFormEventEntity () 
	{
		return $this->GetValStringByKey(MapDataAttr::$FormEventEntity);
	}
	public function setFormEventEntity ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$FormEventEntity, $value);
	}
	public static function getIsEditDtlModel () 
	{
		$s = $WebUser->GetSessionByKey("IsEditDtlModel", "0");
		if ($s->equals("0"))
		{
			return  FALSE ;
		}
		else
		{
			return  TRUE ;
		}
	}
	public static function setIsEditDtlModel ($value) // [boolean value]
	{
		$WebUser->SetSessionByKey("IsEditDtlModel", "1");
	}
	public function GenerHisFrm () 
	{
		$body =DataType->ReadTextFile((SystemConfig::getPathOfWebApp() . "\\WF\\Admin\\CCFormDesigner\\EleTemplate\\Body.txt"));
		$body = $body->replace("@FrmH", $String->valueOf($this->getFrmH()));
		$body = $body->replace("@FrmW", $String->valueOf($this->getFrmW()));
		$labTemplate =DataType->ReadTextFile((SystemConfig::getPathOfWebApp() . "\\WF\\Admin\\CCFormDesigner\\EleTemplate\\Label.txt"));
		$myLabs = "";
		$labs = FrmLabs::constructor__String($this->getNo());
		foreach ($labs->ToJavaList() as $lab) 		{
			$tempVar = $labTemplate;
			$labTxt = ( ($tempVar instanceof String) ? $tempVar : NULL );
			$labTxt = $labTxt->replace("@MyPK", $lab->getMyPK());
			$labTxt = $labTxt->replace("@Label", $lab->getText());
			$labTxt = $labTxt->replace("@X", $String->valueOf($lab->getX()));
			$labTxt = $labTxt->replace("@Y", $String->valueOf($lab->getY()));
			$y1 = ($lab->getY() - 20);
			$labTxt = $labTxt->replace("@Y1", $String->valueOf($y1));
			$myLabs += ($labTxt . ",");
		}
		if ($myLabs->equals(""))
		{
			$body = $body->replace("@Labels", $myLabs);
		}
		else
		{
			$myLabs = $myLabs->substring(0, ($myLabs->length() - 1));
			$body = $body->replace("@Labels", $myLabs);
		}
		return $body;
	}
	public function getPTable () 
	{
		$s = $this->GetValStrByKey(MapDataAttr::$PTable);
		if ((($s . NULL) . $s->equals("")))
		{
			return $this->getNo();
		}
		return $s;
	}
	public function setPTable ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$PTable, $value);
	}
	public function getPTableModel () 
	{
		return $this->GetValIntByKey(MapDataAttr::$PTableModel);
	}
	public function setPTableModel ($value) // [int value]
	{
		$this->SetValByKey(MapDataAttr::$PTableModel, $value);
	}
	public function getUrl () 
	{
		return $this->GetValStrByKey(MapDataAttr::$Url);
	}
	public function setUrl ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$Url, $value);
	}
	public function getHisDBUrl () 
	{
		return $DBUrlType->AppCenterDSN;
	}
	public function getHisFrmTypeInt () 
	{
		return $this->GetValIntByKey(MapDataAttr::$FrmType);
	}
	public function setHisFrmTypeInt ($value) // [int value]
	{
		$this->SetValByKey(MapDataAttr::$FrmType, $value);
	}
	public function getHisFrmType () 
	{
		return FrmType->forValue($this->GetValIntByKey(MapDataAttr::$FrmType));
	}
	public function setHisFrmType ($value) // [FrmType value]
	{
		$this->SetValByKey(MapDataAttr::$FrmType, $value->getValue());
	}
	public function getHisFrmTypeText () 
	{
		return $this->getHisFrmType();
	}
	public function getNote () 
	{
		return $this->GetValStrByKey(MapDataAttr::$Note);
	}
	public function setNote ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$Note, $value);
	}
	public function getIsHaveCA () 
	{
		return $this->GetParaBoolen("IsHaveCA",  FALSE );
	}
	public function setIsHaveCA ($value) // [boolean value]
	{
		$this->SetPara("IsHaveCA", $value);
	}
	public function getFK_FrmSort () 
	{
		return $this->GetValStrByKey(MapDataAttr::$FK_FrmSort);
	}
	public function setFK_FrmSort ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$FK_FrmSort, $value);
	}
	public function getDBSrc () 
	{
		return $this->GetValStrByKey(MapDataAttr::$DBSrc);
	}
	public function setDBSrc ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$DBSrc, $value);
	}
	public function getFK_FormTree () 
	{
		return $this->GetValStrByKey(MapDataAttr::$FK_FormTree);
	}
	public function setFK_FormTree ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$FK_FormTree, $value);
	}
	public function getFK_FormTreeText () 
	{
		return DBAccess->RunSQLReturnStringIsNull((("SELECT Name FROM Sys_FormTree WHERE No='" . $this->getFK_FormTree()) . "'"), "目录错误");
	}
	public function getDtls () 
	{
		return $this->GetValStrByKey(MapDataAttr::$Dtls);
	}
	public function setDtls ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$Dtls, $value);
	}
	public function getEnPK () 
	{
		$s = $this->GetValStrByKey(MapDataAttr::$EnPK);
		if ($DataType->IsNullOrEmpty($s))
		{
			return "OID";
		}
		return $s;
	}
	public function setEnPK ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$EnPK, $value);
	}
	public function getHisEns () 
	{
		if (($this->_HisEns == NULL))
		{
			$this->_HisEns = $BP->En->ClassFactory->GetEns($this->getNo());
		}
		return $this->_HisEns;
	}
	public function getHisEn () 
	{
		return $this->getHisEns()->getNewEntity();
	}
	public function getFrmW () 
	{
		return $this->GetValFloatByKey(MapDataAttr::$FrmW);
	}
	public function setFrmW ($value) // [float value]
	{
		$this->SetValByKey(MapDataAttr::$FrmW, $value);
	}
	public function getFrmH () 
	{
		return $this->GetValFloatByKey(MapDataAttr::$FrmH);
	}
	public function setFrmH ($value) // [float value]
	{
		$this->SetValByKey(MapDataAttr::$FrmH, $value);
	}
	public function getAppType () 
	{
		return $this->GetValStrByKey(MapDataAttr::$AppType);
	}
	public function setAppType ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$AppType, $value);
	}
	public function getBodyAttr () 
	{
		$str = $this->GetValStrByKey(MapDataAttr::$BodyAttr);
		$str = $str->replace("~", "'");
		return $str;
	}
	public function setBodyAttr ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$BodyAttr, $value);
	}
	public function getFlowCtrls () 
	{
		return $this->GetValStrByKey(MapDataAttr::$FlowCtrls);
	}
	public function setFlowCtrls ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$FlowCtrls, $value);
	}
	public function getTableCol () 
	{
		return $this->GetValIntByKey(MapDataAttr::$TableCol);
	}
	public function setTableCol ($value) // [int value]
	{
		$this->SetValByKey(MapDataAttr::$TableCol, $value);
	}
	public function GenerHisMap () 
	{
		$mapAttrs = $this->getMapAttrs();
		if (($mapAttrs->size() == 0))
		{
			$this->RepairMap();
			$mapAttrs = $this->getMapAttrs();
		}
		$map = new Map($this->getPTable(), $this->getName());
		$map->setEnDBUrl(new DBUrl($this->getHisDBUrl()));
		$map->Java_SetEnType($EnType->App);
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$attrs = new Attrs();
		foreach ($mapAttrs->ToJavaList() as $mapAttr) 		{
			$map->AddAttr($mapAttr->getHisAttr());
		}
		$dtls = $this->getMapDtls();
		foreach ($dtls->ToJavaList() as $dtl) 		{
			$dtls1 = GEDtls::constructor__String($dtl->getNo());
			$map->AddDtl($dtls1, "RefPK");
		}
		$map->IsShowSearchKey = $this->getRptIsSearchKey();
		$map->DTSearchWay = $this->getRptDTSearchWay();
		$map->DTSearchKey = $this->getRptDTSearchKey();
		$keys = $this->getRptSearchKeys()->split("[*]", -1);
		foreach ($keys as $key) 		{
			if ($DataType->IsNullOrEmpty($key))
			{
				continue;
			}
			$map->AddSearchAttr($key);
		}
		return $map;
	}
	public function getHisGEEn () 
	{
		if (($this->_HisEn == NULL))
		{
			$this->_HisEn = GEEntity::constructor__String($this->getNo());
		}
		return $this->_HisEn;
	}
	public function GenerGEEntityByDataSet ($ds) // [DataSet ds]
	{
		$en = $this->getHisGEEn();
		$dt = $ds->GetTableByName($this->getNo());
		$en->getRow()->LoadDataTable($dt, $dt->Rows->get(0));
		$dtls = $this->getMapDtls();
		foreach ($dtls->ToJavaList() as $item) 		{
			$dtDtls = $ds->GetTableByName($item->getNo());
			$dtlsEn = GEDtls::constructor__String($item->getNo());
			foreach ($dtDtls->Rows as $dr) 			{
				$dtl = $dtlsEn->getNewEntity();
				$dtl->getRow()->LoadDataTable($dtDtls, $dr);
				$dtlsEn->AddEntity($dtl);
			}
			$en->getDtls()->add($dtDtls);
		}
		return $en;
	}
	public static function GenerHisMap_String ($no) // [String no]
	{
		if (SystemConfig::getIsDebug())
		{
			$md = MapData::constructor__();
			$md->setNo($no);
			$md->Retrieve();
			return $md->GenerHisMap();
		}
		else
		{
			$map =Cash->GetMap($no);
			if (($map == NULL))
			{
				$md = MapData::constructor__();
				$md->setNo($no);
				$md->Retrieve();
				$map = $md->GenerHisMap();
				Cash->SetMap($no, $map);
			}
			return $map;
		}
	}
	public static function constructor__ () 
	{
		$me = new self();
		$me->__init();
		return $me;
	}
	public static function constructor__String ($no) // [String no]
	{
		$me = new self();
		$me->__init();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_MapData", "表单注册�?");
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetEnType($EnType->Sys);
		$map->Java_SetCodeStruct("4");
		$map->AddTBStringPK(MapDataAttr::$No, NULL, "编号",  TRUE ,  FALSE , 1, 200, 100);
		$map->AddTBString(MapDataAttr::$Name, NULL, "描述",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$FormEventEntity, NULL, "事件实体",  TRUE ,  TRUE , 0, 100, 20,  TRUE );
		$map->AddTBString(MapDataAttr::$EnPK, NULL, "实体主键",  TRUE ,  FALSE , 0, 200, 20);
		$map->AddTBString(MapDataAttr::$PTable, NULL, "物理�?",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBInt(MapDataAttr::$PTableModel, 0, "表存储模�?",  TRUE ,  TRUE );
		$map->AddTBString(MapDataAttr::$Url, NULL, "连接(对嵌入式表单有效)",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$Dtls, NULL, "从表",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBInt(MapDataAttr::$FrmW, 900, "FrmW",  TRUE ,  TRUE );
		$map->AddTBInt(MapDataAttr::$FrmH, 1200, "FrmH",  TRUE ,  TRUE );
		$map->AddTBInt(MapDataAttr::$TableCol, 0, "傻瓜表单显示的列",  TRUE ,  TRUE );
		$map->AddTBString(MapDataAttr::$Tag, NULL, "Tag",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$FK_FrmSort, NULL, "表单类别",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$FK_FormTree, NULL, "表单树类�?",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddDDLSysEnum(MapDataAttr::$FrmType, FrmType->FreeFrm->getValue(), "表单类型",  TRUE ,  FALSE , MapDataAttr::$FrmType);
		$map->AddTBInt(MapDataAttr::$FrmShowType, 0, "表单展示方式",  TRUE ,  TRUE );
		$map->AddTBInt(MapDataAttr::$AppType, 0, "应用类型",  TRUE ,  FALSE );
		$map->AddTBString(MapDataAttr::$DBSrc, "local", "数据�?",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddTBString(MapDataAttr::$BodyAttr, NULL, "表单Body属�??",  TRUE ,  FALSE , 0, 100, 20);
		$map->AddTBString(MapDataAttr::$Note, NULL, "备注",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$Designer, NULL, "设计�?",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$DesignerUnit, NULL, "单位",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBString(MapDataAttr::$DesignerContact, NULL, "联系方式",  TRUE ,  FALSE , 0, 500, 20);
		$map->AddTBInt(MapDataAttr::$Idx, 100, "顺序�?",  TRUE ,  TRUE );
		$map->AddTBString(MapDataAttr::$GUID, NULL, "GUID",  TRUE ,  FALSE , 0, 128, 20);
		$map->AddTBString(MapDataAttr::$Ver, NULL, "版本�?",  TRUE ,  FALSE , 0, 30, 20);
		$map->AddTBString(MapDataAttr::$FlowCtrls, NULL, "流程控件",  TRUE ,  TRUE , 0, 200, 20);
		$map->AddTBAtParas(4000);
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	public function DoUp () 
	{
		$this->DoOrderUp(MapDataAttr::$FK_FormTree, $this->getFK_FormTree(), MapDataAttr::$Idx);
	}
	public function DoOrderDown () 
	{
		$this->DoOrderDown(MapDataAttr::$FK_FormTree, $this->getFK_FormTree(), MapDataAttr::$Idx);
	}
	public function CheckPTableSaveModel ($filed) // [String filed]
	{
		if (($this->getPTableModel() == 2))
		{
			if ((DBAccess->IsExitsTableCol($this->getPTable(), $filed) ==  FALSE ))
			{
				throw new \RuntimeException((("@表单的表存储模式不允许您创建不存在的字段(" . $filed) . ")，不允许修改表结�?."));
			}
		}
	}
	public static function GetFieldsOfPTableMode2 ($frmID) // [String frmID]
	{
		$pTable = "";
		$dtl = MapDtl::constructor__();
		$dtl->setNo($frmID);
		if (($dtl->RetrieveFromDBSources() == 1))
		{
			$pTable = $dtl->getPTable();
		}
		else
		{
			$md = MapData::constructor__();
			$md->setNo($frmID);
			$md->RetrieveFromDBSources();
			$pTable = $md->getPTable();
		}
		$dt =DBAccess->GetTableSchema($pTable);
		$mydt =DBAccess->GetTableSchema($pTable);
		$mydt->Rows->clear();
		$attrs = MapAttrs::constructor__String($frmID);
		$flowFiels = ",GUID,PRI,PrjNo,PrjName,PEmp,AtPara,FlowNote,WFSta,PNodeID,FK_FlowSort,FK_Flow,OID,FID,Title,WFState,CDT,FlowStarter,FlowStartRDT,FK_Dept,FK_NY,FlowDaySpan,FlowEmps,FlowEnder,FlowEnderRDT,FlowEndNode,MyNum,PWorkID,PFlowNo,BillNo,ProjNo,";
		foreach ($dt->Rows as $dr) 		{
			$key = $dr->get("FName");
			if (($attrs->Contains(MapAttrAttr::$KeyOfEn, $key) ==  TRUE ))
			{
				continue;
			}
			if (($flowFiels->contains((("," . $key) . ",")) ==  TRUE ))
			{
				continue;
			}
			$mydr = $mydt->NewRow();
			$mydr->setValue("FName", $dr->get("FName"));
			$mydr->setValue("FType", $dr->get("FType"));
			$mydr->setValue("FLen", $dr->get("FLen"));
			$mydr->setValue("FDesc", $dr->get("FDesc"));
			$mydt->Rows->add($mydr);
		}
		return $mydt;
	}
	public function getHisFEB () 
	{
		if ($this->getFormEventEntity()->equals(""))
		{
			return NULL;
		}
		if (($this->_HisFEB == NULL))
		{
			$this->_HisFEB = Glo->GetFormEventBaseByEnName($this->getNo());
		}
		return $this->_HisFEB;
	}
	public function DoEvent_String_Entity ($eventType, $en) // [String eventType, Entity en]
	{
			/* match: String_Entity_String */
		return $this->DoEvent_String_Entity_String($eventType, $en, NULL);
	}
	public function DoEvent_String_Entity_String ($eventType, $en, $atParas) // [String eventType, Entity en, String atParas]
	{
		if ((FrmEventList::$FrmLoadBefore->equals($eventType) ==  TRUE ))
		{
			$BP->En->OverrideFile->FrmEvent_LoadBefore($this->getNo(), $en);
		}
		if ((FrmEventList::$FrmLoadAfter->equals($eventType) ==  TRUE ))
		{
			$BP->En->OverrideFile->FrmEvent_FrmLoadAfter($this->getNo(), $en);
		}
		if ((FrmEventList::$SaveBefore->equals($eventType) ==  TRUE ))
		{
			$BP->En->OverrideFile->FrmEvent_SaveBefore($this->getNo(), $en);
		}
		if ((FrmEventList::$SaveAfter->equals($eventType) ==  TRUE ))
		{
			$BP->En->OverrideFile->FrmEvent_SaveAfter($this->getNo(), $en);
		}
			/* match: String_Entity */
		$str = $this->getFrmEvents()->DoEventNode_String_Entity($eventType, $en);
		$mystrs = NULL;
		if (($this->getHisFEB() != NULL))
		{
			$mystrs = $this->getHisFEB()->DoIt($eventType, $en, $atParas);
		}
		if (($str . NULL))
		{
			return $mystrs;
		}
		if (($mystrs . NULL))
		{
			return $str;
		}
		return (($str . "@") . $mystrs);
	}
	public function Upgrade () 
	{
		$sql = "";
		if ((DBAccess->IsExitsObject("Sys_FrmLine") ==  TRUE ))
		{
			$dbsrc = SFDBSrc::constructor__String("local");
			$dbsrc->Rename("Table", "Sys_FrmLine", "Sys_FrmLineBak");
			$sql = "SELECT * FROM Sys_FrmLineBak ORDER BY FK_MapData ";
			$dt =DBAccess->RunSQLReturnTable($sql);
			foreach ($dt->Rows as $dr) 			{
				$ele = FrmEle::constructor__();
				$ele->Copy($dr);
				$ele->setEleType(FrmEle->Line);
				if (($ele->getIsExits() ==  TRUE ))
				{
					$ele->setMyPK(DBAccess->GenerGUID());
				}
				$ele->Insert();
			}
		}
		if ((DBAccess->IsExitsObject("Sys_FrmLab") ==  TRUE ))
		{
			$dbsrc = SFDBSrc::constructor__String("local");
			$dbsrc->Rename("Table", "Sys_FrmLab", "Sys_FrmLabBak");
			$sql = "SELECT * FROM Sys_FrmLabBak ORDER BY FK_MapData ";
			$dt =DBAccess->RunSQLReturnTable($sql);
			foreach ($dt->Rows as $dr) 			{
				$ele = FrmEle::constructor__();
				$ele->Copy($dr);
				$ele->setEleType(FrmEle->Label);
				$ele->setEleName($dr->get(FrmLabAttr::$Text));
				if (($ele->getIsExits() ==  TRUE ))
				{
					$ele->setMyPK(DBAccess->GenerGUID());
				}
				$ele->Insert();
			}
		}
		if ((DBAccess->IsExitsObject("Sys_FrmBtn") ==  TRUE ))
		{
			$dbsrc = SFDBSrc::constructor__String("local");
			$dbsrc->Rename("Table", "Sys_FrmLab", "Sys_FrmLabBak");
			$sql = "SELECT * FROM Sys_FrmLabBak ORDER BY FK_MapData ";
			$dt =DBAccess->RunSQLReturnTable($sql);
			foreach ($dt->Rows as $dr) 			{
				$ele = FrmEle::constructor__();
				$ele->Copy($dr);
				$ele->setEleType(FrmEle->Line);
				if (($ele->getIsExits() ==  TRUE ))
				{
					$ele->setMyPK(DBAccess->GenerGUID());
				}
				$ele->Insert();
			}
		}
	}
	public static function ImpMapData_DataSet ($ds) // [DataSet ds]
	{
		$errMsg = "";
		if (($ds->Tables->contains("WF_Flow") ==  TRUE ))
		{
			$errMsg += "@此模板文件为流程模板�?";
		}
		if (($ds->Tables->contains("Sys_MapAttr") ==  FALSE ))
		{
			$errMsg += "@缺少�?:Sys_MapAttr";
		}
		if (($ds->Tables->contains("Sys_MapData") ==  FALSE ))
		{
			$errMsg += "@缺少�?:Sys_MapData";
		}
		if (!$errMsg->equals(""))
		{
			throw new \RuntimeException($errMsg);
		}
		$dt = $ds->GetTableByName("Sys_MapData");
		$fk_mapData = $dt->Rows->get(0)->getValue("No");
		$md = MapData::constructor__();
		$md->setNo($fk_mapData);
		if ($md->getIsExits())
		{
			throw new \RuntimeException((("@已经存在(" . $fk_mapData) . ")的表单ID，所以您不能导入�?"));
		}
			/* match: String_DataSet */
		return MapData->ImpMapData_String_DataSet($fk_mapData, $ds);
	}
	public static function SetFrmIsReadonly ($fk_mapdata) // [String fk_mapdata]
	{
		$attrs = MapAttrs::constructor__String($fk_mapdata);
		foreach ($attrs->ToJavaList() as $attr) 		{
			if ($attr->getDefValReal()->contains("@"))
			{
				$attr->setUIIsEnable( FALSE );
				$attr->setDefValReal("");
				$attr->SetValByKey("ExtDefVal", "");
				$attr->Update();
				continue;
			}
			if (($attr->getUIIsEnable() ==  TRUE ))
			{
				$attr->setUIIsEnable( FALSE );
				$attr->Update();
				continue;
			}
		}
		$dtls = MapDtls::constructor__String($fk_mapdata);
		foreach ($dtls->ToJavaList() as $dtl) 		{
			$dtl->setIsInsert( FALSE );
			$dtl->setIsUpdate( FALSE );
			$dtl->setIsDelete( FALSE );
			$dtl->Update();
			$attrs = MapAttrs::constructor__String($dtl->getNo());
			foreach ($attrs->ToJavaList() as $attr) 			{
				if ($attr->getDefValReal()->contains("@"))
				{
					$attr->setUIIsEnable( FALSE );
					$attr->setDefValReal("");
					$attr->SetValByKey("ExtDefVal", "");
					$attr->Update();
				}
				if (($attr->getUIIsEnable() ==  TRUE ))
				{
					$attr->setUIIsEnable( FALSE );
					$attr->Update();
					continue;
				}
			}
		}
		$aths = FrmAttachments::constructor__String($fk_mapdata);
		foreach ($aths->ToJavaList() as $item) 		{
			$item->setIsUpload( FALSE );
			$item->setHisDeleteWay(AthDeleteWay::$DelSelf);
			if (($fk_mapdata->indexOf("ND") == 0))
			{
				$item->setHisCtrlWay(AthCtrlWay::$PK);
				$item->setDataRefNoOfObj("AttachM1");
			}
			$item->Update();
		}
	}
	public static function ImpMapData_String_DataSet ($fk_mapdata, $ds) // [String fk_mapdata, DataSet ds]
	{
		$errMsg = "";
		$listD = $ds->getTables();
		$arr = [];// 
		foreach ($listD as $dt) 		{
			$arr->add($dt->TableName);
		}
		if (($arr->contains("WF_Flow") ==  TRUE ))
		{
			$errMsg += "@此模板文件为流程模板�?";
		}
		if (($arr->contains("Sys_MapAttr") ==  FALSE ))
		{
			$errMsg += "@缺少�?:Sys_MapAttr";
		}
		if (($arr->contains("Sys_MapData") ==  FALSE ))
		{
			$errMsg += "@缺少�?:Sys_MapData";
		}
		$num = $arr->indexOf("Sys_MapAttr");
		$dtCheck = $ds->Tables->get($num);
		$isHave =  FALSE ;
		foreach ($dtCheck->Rows as $dr) 		{
			if ($dr->get("KeyOfEn")->equals("OID"))
			{
				$isHave =  TRUE ;
				break;
			}
		}
		if (($isHave ==  FALSE ))
		{
			$errMsg += "@表单模版缺少�?:OID";
		}
		if (!$errMsg->equals(""))
		{
			throw new \RuntimeException(("@以下错误不可导入，可能的原因是非表单模板文件:" . $errMsg));
		}
		$endDoSQL = "";
		$mdOld = MapData::constructor__();
		$mdOld->setNo($fk_mapdata);
		$mdOld->RetrieveFromDBSources();
		$mdOld->Delete();
		$oldMapID = "";
		$dtMap = $ds->GetTableByName("Sys_MapData");
		if (($dtMap->Rows->size() == 1))
		{
			$oldMapID = $dtMap->Rows->get(0)->getValue("No");
		}
		else
		{
			foreach ($dtMap->Rows as $dr) 			{
				$oldMapID = $dr->get("No");
			}
			if (($DataType->IsNullOrEmpty($oldMapID) ==  TRUE ))
			{
				$oldMapID = $dtMap->Rows->get(0)->getValue("No");
			}
		}
		$timeKey = $DateUtils->format(new Date(), "MMddHHmmss");
		foreach ($ds->Tables as $dt) 		{
			$idx = 0;
			switch ($dt->TableName) {
				case "Sys_MapDtl":
					foreach ($dt->Rows as $dr) 					{
						$dtl = MapDtl::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$dtl->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$dtl->Insert();
					}
					break;
				case "Sys_MapData":
					foreach ($dt->Rows as $dr) 					{
						$md = MapData::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$md->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						if (($DataType->IsNullOrEmpty($md->getPTable()->trim()) ==  TRUE ))
						{
							$md->setPTable($md->getNo());
						}
						if (($DataType->IsNullOrEmpty($mdOld->getFK_FormTree()) ==  FALSE ))
						{
							$md->setFK_FormTree($mdOld->getFK_FormTree());
						}
						if (($DataType->IsNullOrEmpty($mdOld->getFK_FrmSort()) ==  FALSE ))
						{
							$md->setFK_FrmSort($mdOld->getFK_FrmSort());
						}
						if (($DataType->IsNullOrEmpty($mdOld->getPTable()) ==  FALSE ))
						{
							$md->setPTable($mdOld->getPTable());
						}
						if (($DataType->IsNullOrEmpty($mdOld->getName()) ==  FALSE ))
						{
							$md->setName($mdOld->getName());
						}
						$md->setHisFrmType($mdOld->getHisFrmType());
						$md->setAppType($mdOld->getAppType());
						$md->DirectInsert();
					}
					break;
				case "Sys_FrmBtn":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmBtn::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->setMyPK(DBAccess->GenerGUID());
						$en->Insert();
					}
					break;
				case "Sys_FrmLine":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmLine::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->setMyPK(DBAccess->GenerGUID());
						$en->Insert();
					}
					break;
				case "Sys_FrmLab":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmLab::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->setMyPK(DBAccess->GenerGUID());
						$en->Insert();
					}
					break;
				case "Sys_FrmLink":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmLink::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->setMyPK(DBAccess->GenerGUID());
						$en->Insert();
					}
					break;
				case "Sys_FrmEle":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmEle::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->Insert();
					}
					break;
				case "Sys_FrmImg":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmImg::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						if (($DataType->IsNullOrEmpty($en->getKeyOfEn()) ==  TRUE ))
						{
							$en->setMyPK(DBAccess->GenerGUID());
						}
						$en->Insert();
					}
					break;
				case "Sys_FrmImgAth":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmImgAth::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						if ($DataType->IsNullOrEmpty($en->getCtrlID()))
						{
							$en->setCtrlID(("ath" . $idx));
						}
						$en->Insert();
					}
					break;
				case "Sys_FrmRB":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmRB::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						try 
						{
							$en->Save();
						}
						catch (\Exception $e)
						{ /* empty */ }
					}
					break;
				case "Sys_FrmAttachment":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = FrmAttachment::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->setMyPK((($fk_mapdata . "_") . $en->GetValByKey("NoOfObj")));
						try 
						{
							$en->Insert();
						}
						catch (\Exception $e2)
						{ /* empty */ }
					}
					break;
				case "Sys_MapFrame":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = MapFrame::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->DirectInsert();
					}
					break;
				case "Sys_MapExt":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = MapExt::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							if (($DataType->IsNullOrEmpty($val) ==  TRUE ))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->InitPK();
						$en->Save();
					}
					break;
				case "Sys_MapAttr":
					foreach ($dt->Rows as $dr) 					{
						$en = MapAttr::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
						}
						$en->setMyPK((($en->getFK_MapData() . "_") . $en->getKeyOfEn()));
						try 
						{
							$en->DirectInsert();
						}
						catch (\Exception $e3)
						{ /* empty */ }
					}
					break;
				case "Sys_GroupField":
					foreach ($dt->Rows as $dr) 					{
						++$idx;
						$en = GroupField::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof Object) ? $dr->get($dc->ColumnName) : NULL );
							if (($val == NULL))
							{
								continue;
							}
							try 
							{
								$en->SetValByKey($dc->ColumnName, $val->replace($oldMapID, $fk_mapdata));
							}
							catch (\Exception $e4)
							{
								throw new \RuntimeException(((((("val:" . $val) . "oldMapID:") . $oldMapID) . "fk_mapdata:") . $fk_mapdata));
							}
						}
						$beforeID = $en->getOID();
						$en->setOID(0);
						$en->DirectInsert();
						$endDoSQL += (((((("@UPDATE Sys_MapAttr SET GroupID=" . $en->getOID()) . " WHERE FK_MapData='") . $fk_mapdata) . "' AND GroupID='") . $beforeID) . "'");
					}
					break;
				case "Sys_Enum":
					foreach ($dt->Rows as $dr) 					{
						$se = SysEnum::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof String) ? $dr->get($dc->ColumnName) : NULL );
							$se->SetValByKey($dc->ColumnName, $val);
						}
						$se->setMyPK((((($se->getEnumKey() . "_") . $se->getLang()) . "_") . $se->getIntKey()));
						if ($se->getIsExits())
						{
							continue;
						}
						$se->Insert();
					}
					break;
				case "Sys_EnumMain":
					foreach ($dt->Rows as $dr) 					{
						$sem = SysEnumMain::constructor__();
						foreach ($dt->Columns as $dc) 						{
							$val = ( ($dr->get($dc->ColumnName) instanceof String) ? $dr->get($dc->ColumnName) : NULL );
							if (($val . NULL))
							{
								continue;
							}
							$sem->SetValByKey($dc->ColumnName, $val);
						}
						if ($sem->getIsExits())
						{
							continue;
						}
						$sem->Insert();
					}
					break;
				case "WF_Node":
					if (($dt->Rows->size() > 0))
					{
						$endDoSQL += (((((((((((("@UPDATE WF_Node SET FWCSta=2" . ",FWC_X=") . $dt->Rows->get(0)->getValue("FWC_X")) . ",FWC_Y=") . $dt->Rows->get(0)->getValue("FWC_Y")) . ",FWC_H=") . $dt->Rows->get(0)->getValue("FWC_H")) . ",FWC_W=") . $dt->Rows->get(0)->getValue("FWC_W")) . ",FWCType=") . $dt->Rows->get(0)->getValue("FWCType")) . " WHERE NodeID=") . $fk_mapdata->replace("ND", ""));
					}
					break;
				default:
					break;
			}
		}
		DBAccess->RunSQLs($endDoSQL);
		$mdNew = MapData::constructor__String($fk_mapdata);
		$mdNew->RepairMap();
		if (($mdNew->getNo()->indexOf("ND") == 0))
		{
			$mdNew->setFK_FrmSort("");
			$mdNew->setFK_FormTree("");
		}
		$mdNew->Update();
		return $mdNew;
	}
	public function RepairMap () 
	{
		$gfs = GroupFields::constructor__String($this->getNo());
		if (($gfs->size() == 0))
		{
			$gf = GroupField::constructor__();
			$gf->setFrmID($this->getNo());
			$gf->setLab($this->getName());
			$gf->Insert();
			$sqls = "";
			$sqls += (((("@UPDATE Sys_MapDtl SET GroupID=" . $gf->getOID()) . " WHERE FK_MapData='") . $this->getNo()) . "'");
			$sqls += (((("@UPDATE Sys_MapAttr SET GroupID=" . $gf->getOID()) . " WHERE FK_MapData='") . $this->getNo()) . "'");
			$sqls += (((("@UPDATE Sys_FrmAttachment SET GroupID=" . $gf->getOID()) . " WHERE FK_MapData='") . $this->getNo()) . "'");
			DBAccess->RunSQLs($sqls);
		}
		else
		{
			if ((SystemConfig::getAppCenterDBType() != $DBType->Oracle))
			{
				$gfFirst = ( ($gfs->get(0) instanceof GroupField) ? $gfs->get(0) : NULL );
				$sqls = "";
				$sqls += (((((("@UPDATE Sys_FrmAttachment SET GroupID=" . $gfFirst->getOID()) . " WHERE  MyPK IN (SELECT X.MyPK FROM (SELECT MyPK FROM Sys_FrmAttachment WHERE GroupID NOT IN (SELECT OID FROM Sys_GroupField WHERE FrmID='") . $this->getNo()) . "')) AS X) AND FK_MapData='") . $this->getNo()) . "' ");
				try 
				{
					DBAccess->RunSQLs($sqls);
				}
				catch (\Exception $e)
				{ /* empty */ }
			}
		}
		$attr = MapAttr::constructor__();
		if ($this->getEnPK()->equals("OID"))
		{
			if (($attr->IsExit(MapAttrAttr::$KeyOfEn, "OID", MapAttrAttr::$FK_MapData, $this->getNo()) ==  FALSE ))
			{
				$attr->setFK_MapData($this->getNo());
				$attr->setKeyOfEn("OID");
				$attr->setName("OID");
				$attr->setMyDataType(DataType->AppInt);
				$attr->setUIContralType($UIContralType->TB);
				$attr->setLGType($FieldTypeS->Normal);
				$attr->setUIVisible( FALSE );
				$attr->setUIIsEnable( FALSE );
				$attr->setDefVal("0");
				$attr->setHisEditType($BP->En->EditType->Readonly);
				$attr->Insert();
			}
		}
		if (($this->getEnPK()->equals("No") || $this->getEnPK()->equals("MyPK")))
		{
			if (($attr->IsExit(MapAttrAttr::$KeyOfEn, $this->getEnPK(), MapAttrAttr::$FK_MapData, $this->getNo()) ==  FALSE ))
			{
				$attr->setFK_MapData($this->getNo());
				$attr->setKeyOfEn($this->getEnPK());
				$attr->setName($this->getEnPK());
				$attr->setMyDataType(DataType->AppInt);
				$attr->setUIContralType($UIContralType->TB);
				$attr->setLGType($FieldTypeS->Normal);
				$attr->setUIVisible( FALSE );
				$attr->setUIIsEnable( FALSE );
				$attr->setDefVal("0");
				$attr->setHisEditType($BP->En->EditType->Readonly);
				$attr->Insert();
			}
		}
		if (($attr->IsExit(MapAttrAttr::$KeyOfEn, "RDT", MapAttrAttr::$FK_MapData, $this->getNo()) ==  FALSE ))
		{
			$attr = MapAttr::constructor__();
			$attr->setFK_MapData($this->getNo());
			$attr->setHisEditType($BP->En->EditType->UnDel);
			$attr->setKeyOfEn("RDT");
			$attr->setName("更新时间");
			$attr->setGroupID(0);
			$attr->setMyDataType(DataType->AppDateTime);
			$attr->setUIContralType($UIContralType->TB);
			$attr->setLGType($FieldTypeS->Normal);
			$attr->setUIVisible( FALSE );
			$attr->setUIIsEnable( FALSE );
			$attr->setDefVal("@RDT");
			$attr->setTag("1");
			$attr->Insert();
		}
		$attrs = MapAttrs::constructor__();
		$attrs->Retrieve(MapAttrAttr::$FK_MapData, $this->getNo());
		foreach ($attrs->ToJavaList() as $item) 		{
			if ((($item->getLGType() == $FieldTypeS->Enum) || ($item->getLGType() == $FieldTypeS->FK)))
			{
				if (($DataType->IsNullOrEmpty($item->getUIBindKey()) ==  TRUE ))
				{
					$item->setLGType($FieldTypeS->Normal);
					$item->setUIContralType($UIContralType->TB);
					$item->Update();
				}
			}
		}
	}
	protected function beforeInsert () 
	{
		if ((($this->getHisFrmType() == FrmType::$Url) || ($this->getHisFrmType() == FrmType::$Entity)))
		else
		{
			$this->setPTable(PubClass::DealToFieldOrTableNames($this->getPTable()));
		}
		return parent->beforeInsert();
	}
	public function ResetMaxMinXY () 
	{
		if (($this->getHisFrmType() != FrmType::$FreeFrm))
		{
			return ;
		}
		$i1 = DBAccess->RunSQLReturnValFloat((("SELECT MIN(X1) FROM Sys_FrmLine WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		if (($i1 == 0))
		{
			$i1 = DBAccess->RunSQLReturnValFloat((("SELECT MIN(X) FROM Sys_FrmImg WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		}
		$i2 = DBAccess->RunSQLReturnValFloat((("SELECT MIN(X)  FROM Sys_FrmLab  WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		if (($i1 > $i2))
		{
			$this->setMaxLeft($i2);
		}
		else
		{
			$this->setMaxLeft($i1);
		}
		$i1 = DBAccess->RunSQLReturnValFloat((("SELECT Max(X2) FROM Sys_FrmLine WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		if (($i1 == 0))
		{
			$i1 = DBAccess->RunSQLReturnValFloat((("SELECT Max(X+W) FROM Sys_FrmImg WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		}
		$this->setMaxRight($i1);
		$i1 = DBAccess->RunSQLReturnValFloat((("SELECT MIN(Y1) FROM Sys_FrmLine WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		$i2 = DBAccess->RunSQLReturnValFloat((("SELECT MIN(Y)  FROM Sys_FrmLab  WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		if (($i1 > $i2))
		{
			$this->setMaxTop($i2);
		}
		else
		{
			$this->setMaxTop($i1);
		}
		$i1 = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y1) FROM Sys_FrmLine WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		if (($i1 == 0))
		{
			$i1 = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y+H) FROM Sys_FrmImg WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		}
		$i2 = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y)  FROM Sys_FrmLab  WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		if (($i2 == 0))
		{
			$i2 = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y+H) FROM Sys_FrmImg WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		}
		$endFrmAtt = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y+H)  FROM Sys_FrmAttachment  WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		$endFrmDtl = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y+H)  FROM Sys_MapDtl  WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		$endFrmEle = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y+H)  FROM Sys_FrmEle  WHERE FK_MapData='" . $this->getNo()) . "'"), 0);
		$endFrmAttr = DBAccess->RunSQLReturnValFloat((("SELECT Max(Y+UIHeight)  FROM  Sys_MapAttr  WHERE FK_MapData='" . $this->getNo()) . "' and UIVisible='1'"), 0);
		if (($i1 > $i2))
		{
			$this->setMaxEnd($i1);
		}
		else
		{
			$this->setMaxEnd($i2);
		}
		$this->setMaxEnd(( (($this->getMaxEnd() > $endFrmAtt)) ? $this->getMaxEnd() : $endFrmAtt ));
		$this->setMaxEnd(( (($this->getMaxEnd() > $endFrmDtl)) ? $this->getMaxEnd() : $endFrmDtl ));
		$this->setMaxEnd(( (($this->getMaxEnd() > $endFrmEle)) ? $this->getMaxEnd() : $endFrmEle ));
		$this->setMaxEnd(( (($this->getMaxEnd() > $endFrmAtt)) ? $this->getMaxEnd() : $endFrmAttr ));
		$this->DirectUpdate();
	}
	public static function GenerSpanWeiYi ($md, $scrWidth) // [MapData md, float scrWidth]
	{
		if (($scrWidth == 0))
		{
			$scrWidth = 900;
		}
		$left = $md->getMaxLeft();
		if (($left == 0))
		{
			$md->ResetMaxMinXY();
			$md->RetrieveFromDBSources();
			$md->Retrieve();
			$left = $md->getMaxLeft();
		}
		if (($left == 0))
		{
			return $left;
		}
		$right = $md->getMaxRight();
		$withFrm = ($right - $left);
		if (($withFrm >= $scrWidth))
		{
			return -$left;
		}
		$space = ((($scrWidth - $withFrm)) / 2);
		return -(($left - $space));
	}
	public static function GenerSpanWidth ($md, $scrWidth) // [MapData md, float scrWidth]
	{
		if (($scrWidth == 0))
		{
			$scrWidth = 900;
		}
		$left = $md->getMaxLeft();
		if (($left == 0))
		{
			$md->ResetMaxMinXY();
			$left = $md->getMaxLeft();
		}
		$right = $md->getMaxRight();
		$withFrm = ($right - $left);
		if (($withFrm >= $scrWidth))
		{
			return $withFrm;
		}
		return $scrWidth;
	}
	public static function GenerSpanHeight ($md, $scrHeight) // [MapData md, float scrHeight]
	{
		if (($scrHeight == 0))
		{
			$scrHeight = 1200;
		}
		$end = $md->getMaxEnd();
		if (($end > $scrHeight))
		{
			return ($end + 10);
		}
		else
		{
			return $scrHeight;
		}
	}
	protected function beforeUpdateInsertAction () 
	{
		if ((($this->getHisFrmType() == FrmType::$Url) || ($this->getHisFrmType() == FrmType::$Entity)))
		{
			return parent->beforeUpdateInsertAction();
		}
		$this->setPTable(PubClass::DealToFieldOrTableNames($this->getPTable()));
		$this->getMapAttrs()->Retrieve(MapAttrAttr::$FK_MapData, $this->getPTable());
		$this->setVer($DataType->getCurrentDataTimess());
		$isHaveCA =  FALSE ;
		foreach ($this->getMapAttrs()->ToJavaList() as $item) 		{
			if (($item->getSignType() == SignType::$CA))
			{
				$isHaveCA =  TRUE ;
				break;
			}
		}
		$this->setIsHaveCA($isHaveCA);
		if (($this->getIsHaveCA() ==  TRUE ))
		return parent->beforeUpdateInsertAction();
	}
	public function UpdateVer () 
	{
		$sql = (((("UPDATE Sys_MapData SET VER='" .DataType->getCurrentDataTimess()) . "' WHERE No='") . $this->getNo()) . "'");
		DBAccess::RunSQL($sql);
	}
	protected function beforeDelete () 
	{
		$sql = "";
		$sql = (("SELECT * FROM Sys_MapDtl WHERE FK_MapData ='" . $this->getNo()) . "'");
		$Sys_MapDtl = DBAccess->RunSQLReturnTable($sql);
		$whereFK_MapData = (("FK_MapData= '" . $this->getNo()) . "' ");
		$whereEnsName = (("FrmID= '" . $this->getNo()) . "' ");
		$whereNo = (("No='" . $this->getNo()) . "' ");
		foreach ($Sys_MapDtl->Rows as $dr) 		{
			$whereFK_MapData += ((" OR FK_MapData='" . $dr->get("No")) . "' ");
			$whereEnsName += ((" OR FrmID='" . $dr->get("No")) . "' ");
			$whereNo += ((" OR No='" . $dr->get("No")) . "' ");
		}
		$sql = (("DELETE FROM Sys_MapDtl WHERE FK_MapData='" . $this->getNo()) . "'");
		$sql += ("@DELETE FROM Sys_FrmLine WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmEle WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmEvent WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmBtn WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmLab WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmLink WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmImg WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmImgAth WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmRB WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_FrmAttachment WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_MapFrame WHERE " . $whereFK_MapData);
		if (($this->getNo()->contains("BP.") ==  FALSE ))
		{
			$sql += ("@DELETE FROM Sys_MapExt WHERE " . $whereFK_MapData);
		}
		$sql += ("@DELETE FROM Sys_MapAttr WHERE " . $whereFK_MapData);
		$sql += ("@DELETE FROM Sys_GroupField WHERE " . $whereEnsName);
		$sql += ("@DELETE FROM Sys_MapData WHERE " . $whereNo);
		$sql += (("@DELETE FROM WF_FrmNode WHERE FK_Frm='" . $this->getNo()) . "'");
		$sql += ("@DELETE FROM Sys_FrmSln WHERE " . $whereFK_MapData);
		DBAccess->RunSQLs($sql);
		if ((DBAccess->IsExitsObject($this->getPTable()) && ($this->getPTable()->indexOf("ND") == 0)))
		{
			$sql = (((("SELECT COUNT(No) AS NUM  FROM Sys_MapData WHERE PTable='" . $this->getPTable()) . "' OR ( PTable='' AND No='") . $this->getPTable()) . "')");
			if ((DBAccess->RunSQLReturnValInt($sql, 0) > 1))
			else
			{
				if ((DBAccess->RunSQLReturnValInt((("SELECT COUNT(*) FROM " . $this->getPTable()) . " WHERE 1=1 ")) == 0))
				{
					DBAccess::RunSQL(("DROP TABLE " . $this->getPTable()));
				}
			}
		}
		$dtls = MapDtls::constructor__String($this->getNo());
		foreach ($dtls->ToJavaList() as $dtl) 		{
			$dtl->Delete();
		}
		$sfs = SFTables::constructor__();
		$sfs->Retrieve(SFTableAttr::$SrcTable, $this->getPTable());
		foreach ($sfs->ToJavaList() as $item) 		{
			if (($item->IsCanDelete() == NULL))
			{
				$item->Delete();
			}
		}
		return parent->beforeDelete();
	}
	public function ExcelGenerFile ($pkValue, $bytes) // [int pkValue, RefObject<byte[]> bytes]
	{
		$by =DBAccess->GetByteFromDB($this->getPTable(), $this->getEnPK(), (new Integer($pkValue)), "DBFile");
		if (($by != NULL))
		{
			$bytes->argvalue = $by;
			return  TRUE ;
		}
		else
		{
			$tempExcel = (((SystemConfig::getPathOfDataUser() . "FrmOfficeTemplate/") . $this->getNo()) . ".xlsx");
			$file = new File($tempExcel);
			if (($file->exists() ==  TRUE ))
			{
				$bytes->argvalue =DataType->ConvertFileToByte($tempExcel);
				return  FALSE ;
			}
			else
			{
				throw new \RuntimeException((("@没有找到模版文件." . $tempExcel) . " 请确认表单配�?."));
			}
		}
	}
	public function ExcelSaveFile ($pkValue, $bty, $saveTo) // [String pkValue, byte[] bty, String saveTo]
	{
		DBAccess->SaveFileToDB($bty, $this->getPTable(), $this->getEnPK(), (new Integer($pkValue)), "DBFile");
	}
	public function WordGenerFile ($pkValue, $bytes, $saveTo) // [String pkValue, RefObject<byte[]> bytes, String saveTo]
	{
		$by =DBAccess->GetByteFromDB($this->getPTable(), $this->getEnPK(), $pkValue, $saveTo);
		if (($by != NULL))
		{
			$bytes->argvalue = $by;
			return ;
		}
		else
		{
			$tempExcel = (((SystemConfig::getPathOfDataUser() . "FrmOfficeTemplate\\") . $this->getNo()) . ".docx");
			if (((new File($tempExcel))->isFile() ==  FALSE ))
			{
				$tempExcel = (SystemConfig::getPathOfDataUser() . "FrmOfficeTemplate\\NDxxxRpt.docx");
			}
			$bytes->argvalue =DataType->ConvertFileToByte($tempExcel);
			return ;
		}
	}
	public function WordSaveFile ($pkValue, $bty, $saveTo) // [String pkValue, byte[] bty, String saveTo]
	{
		DBAccess->SaveBytesToDB($bty, NULL, $this->getPTable(), $this->getEnPK(), $pkValue, $saveTo);
	}
	public function setDesignerTool ($value) // [String value]
	{
		$this->SetValByKey(MapDataAttr::$DesignerTool, $value);
	}
}
?>
